package com.banzhi.shop.utils;

import android.content.Context;
import android.net.Uri;
import android.widget.ImageView;

import com.banzhi.shop.R;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.squareup.picasso.MemoryPolicy;
import com.squareup.picasso.NetworkPolicy;
import com.squareup.picasso.Picasso;

/**
 * Created by Administrator on 2018/10/17.
 */

public class GlideUtils {
    /*
    *直接加载图片(没有占位图等其他处理,仅仅是加载一张图)
    *imageUrl图片地址
    *
    * */
    public static void loadImage(Context context, ImageView imageView, String imageUrl){
        Glide.with(context)
                .load(imageUrl)
                .dontAnimate()
                .diskCacheStrategy(DiskCacheStrategy.SOURCE)
                .into(imageView);
    }

    public static void loadImage(Context context, ImageView imageView, Uri uri){
        Glide.with(context)
                .load(uri)
                .dontAnimate()
                .diskCacheStrategy(DiskCacheStrategy.SOURCE)
                .into(imageView);
    }

    public static void loadImage(Context context, ImageView imageView, Integer uri){
        Glide.with(context)
                .load(uri)
                .dontAnimate()
                .diskCacheStrategy(DiskCacheStrategy.SOURCE)
                .into(imageView);
    }
    public static void loadHomeImage (Context context, ImageView imageView, String imageUrl){
        Picasso.with(context).load(imageUrl).
                memoryPolicy(MemoryPolicy.NO_CACHE).
                networkPolicy(NetworkPolicy.NO_CACHE)
                .placeholder(R.mipmap.zhanweitu1)
                .fit()
                .into(imageView);
    }





}
